﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

#pragma once

#include "GcmpModelInterface.h"
#include "IEventArgs.h"
#include "ElementId.h"


namespace gcmp
{
    class IDocument;

    /// \brief 单元格事件类型
    ///
    /// 
    enum class DrawingTableItemEventType : int32_t
    {
        GRepChange = 0,           ///< 单元格的视图Grep发生改变
        TableItemIsPreRestored = 1,  ///< 复合单元格被恢复之前
        TableItemIsPostRestored = 2, ///< 复合单元格被恢复之后
        TableItemIsPostMerged = 3,  ///< 单元格被合并之后
        TableItemTextChanged = 4,   ///< 单元格文本内容变更事件
        PostAddRelatedElementId = 5,  ///< 单元格绑定图例之后
        PreClearRelatedElementId = 6, ///< 单元格解绑图例之前
    };

    /// \brief  单元格事件参数
    ///
    class GCMP_MODEL_INTERFACE_EXPORT IDrawingTableItemEventArgs : public IEventArgs
    {
        DEFINE_CAST_DERIVED(gcmp::IDrawingTableItemEventArgs, gcmp::IEventArgs)
    public:

        ///  \brief 获取单元格事件类型
        ///
        /// \return 单元格类型
        virtual DrawingTableItemEventType GetType() const = 0;

        ///  \brief 获取单元格事件对应的文档
        ///
        /// \return 单元格事件文档指针
        virtual IDocument* GetDocument() const = 0;

        ///  \brief 获取单元格事件对应的视图Id
        ///
        /// \return 视图Id
        virtual ElementId GetModelViewId() const = 0;

        /// \brief 获取单元格事件对应的单元格ElementId
        ///
        /// \return 单元格ElementId
        virtual ElementId GetDrawingTableItemId() const = 0;

        /// \brief 获取单元格对应的表格ElementId
        ///
        /// \return 表格ElementId
        virtual ElementId GetDrawingTableElementId() const = 0;

        /// \brief 获取单元格新绑定的关联图例ElementId
        ///
        /// \return 新绑定的关联图例ElementId
        virtual const std::set<ElementId>& GetNewAddRelatedElementIds() const = 0;

        /// \brief 获取单元格即将解绑定的关联图例ElementId
        ///
        /// \return 即将解绑定的关联图例ElementId
        virtual const std::set<ElementId>& GetNewPreClearRelatedElementIds() const = 0;
    };
}